const express = require('express')
const router = express.Router()

// 解析 post 请求数据
const bodyparser = require('body-parser')
router.use(bodyparser.urlencoded({ extended: false }))
router.use(bodyparser.json())
// 配置 session
const session = require('express-session')
router.use(session({
   secret: 'key scd', // 签名
   saveUninitialized: false,
   resave: true,
   cookie: { maxAge: 1000 * 60 }
}))

// 引入子路由模块
const user = require('../router/user')
const shop = require('../router/shop')
const address = require('../router/address')
const order = require('../router/order')
const comment = require('../router/comment')
const search = require('../router/search')
router.use('/user', user)
router.use('/shop', shop)
router.use('/address', address)
router.use('/order', order)
router.use('/comment', comment)
router.use('/search', search)

module.exports = router